package com.zzh.partnersys.controller;


import com.zzh.partnersys.common.exception.BusinessException;
import com.zzh.partnersys.common.exception.ResultCodeEnum;
import com.zzh.partnersys.common.exception.ResultUtils;
import com.zzh.partnersys.entity.vo.UserFriendVO;
import com.zzh.partnersys.service.UserFriendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 用户联系人表 前端控制�?
 * </p>
 *
 * @author zzh
 * @since 2024-08-11
 */
@RestController
@RequestMapping("/userFriend")
public class UserFriendController {

    @Autowired
    private UserFriendService userFriendService;

    //查询用户联系人列�?
    @GetMapping("/list")
    public ResultUtils listFriend(@RequestParam("userId") Long userId) {
        //参数校验
        if (userId == null) {
            throw new BusinessException(ResultCodeEnum.PARAMS_ERROR);
        }
        //业务逻辑处理
        List<UserFriendVO> userFriendVOList = userFriendService.listFriend(userId);
        return ResultUtils.ok(userFriendVOList);
    }

}

